<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">

    <title>layui</title>
    <#assign base=request.contextPath  />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title></title>
    <link rel="stylesheet" href="${base}/frame/layui/css/layui.css">
    <link rel="stylesheet" href="${base}/frame/static/css/style.css">
    <link rel="icon" href="${base}/frame/static/image/code.png">
    <script type="text/javascript" src="${base}/frame/layui/layui.js"></script>
    <script type="text/javascript" src="${base}/js/zhang.js"></script>
    <script src="${base}/jquery-1.8.3.min.js"></script>
    <style>
        body{ overflow-x: hidden; overflow-y: auto; }
    </style>
</head>
<body class="body">
<div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
    <div class="my-btn-box">
    <span class="layui-form-label">车辆品牌</span>
    <div class="layui-input-inline">
        <input type="text" autocomplete="off" placeholder="" class="layui-input" id="phone" style="height: 31px;">
    </div>
    <button class="layui-btn  layui-btn-sm layui-btn-normal" id="seche22">查询</button>
    <table class="layui-hide" id="test" lay-filter="test"></table>
    </div>
</div>
<script src="${base}/js/jquery.min.js"></script>
<script>
    layui.use(['laydate','form','table'], function(){
        var laydate = layui.laydate;
        var form = layui.form
        var table = layui.table;
        table.render({
            even: true,//开启隔行背景
            size: 'sm',//小尺寸的表格
            elem: '#test',
            toolbar: '#toolbarDemo',
            url: '${base}/ptMoneyInfo/list',
            title: '用户数据表',
            cols: [[
            {field: 'carNumber', title: '车牌', align: 'center'}
            , {field: 'moeny', title: '金额', align: 'center'}
            , {field: 'ptname', title: '车辆所属公司', align: 'center'}
            , {
                field: 'createTime', templet: function (val) {
                    return DateFormat(val.createTime);
                }, title: '操作时间', align: 'center'
            }
            , {
                field: 'flag', templet: function (val) {
                    if (val.flag == 1) {
                        return "<span>分配</span>"
                    } else {
                        return "<span style='color:red;'>回收</span>"
                    }
                }, title: '分配或是回收', align: 'center'
            }
        ]]
            ,id: 'testReload'
            ,height:480
            ,page: {
                layout: ['limit', 'count', 'prev', 'page', 'next', 'skip']
                ,theme: '#9AC747'
                ,limit: 10
            }
        });
        laydate.render({
            elem: '#test1'
            ,theme: '#393D49'
        });
        laydate.render({
            elem: '#test2'
            ,theme: '#393D49'
        });
    });
    //键盘事件
    $("body").bind("keydown", function (e) {
        // 兼容FF和IE和Opera
        var theEvent = e || window.event;
        var code = theEvent.keyCode || theEvent.which || theEvent.charCode;

        if (code == 13) {
            //回车执行查询
            $("#seche22").click();
        }
    });

    $('#seche22').on('click', function () {
        var whereData = {};
        whereData.carNumber = Trim($("#phone").val())
        var table = layui.table;
        //表刷新方法
        table.reload('testReload', {
            url: '${base}/ptMoneyInfo/list'
            , where: whereData
        });
    })
</script>
</body>

</html>